Arduino Node

With the Arduino board, you can create an interface to test external hardware. TPT supports the Arduino Mega 2560 by itself.

The Arduino board acts as a kind of HiL. TPT sends data to and receives data from the Arduino board. The Arduino board handles the actual connection to the system under test.

TPT is connected to the board using a standard Arduino USB cable. The communication is performed via the PWM pin 0 (RX) and PWM pin 1 (TX). PWM stands for pulse width modulation, where 0 is interpreted as "always off" and 255 as "always on". More about PWM, see https://www.arduino.cc/en/Tutorial/PWM.

The Arduino IDE is needed to compile the INO file and flash it onto the Arduino board, see Examples - Arduino from Scratch.

In order to send data to the Arduino board, you must create output channels in TPT for the digital and analog outputs of the Arduino board. To receive data from the Arduino board, you must create input channels for the digital and analog inputs of the Arduino board, see Declaration Editor.

Each pin on the Arduino board has a name that is either a number or a combination of a letter and a number. The behavior of these pins is specified in the so-called Arduino protocol, see Arduino Node - Protocol. To establish a connection between the Arduino board and TPT, handles must be provided. The handle names in TPT reflect the purpose of the Arduino pin declaration:

Analog out pins
Analog pin (out = PWM) Channel name in TPT
2 analogOut2
3 analogOut3
... ...
13 analogOut13
 
Analog in pins
Analog pin (in) Channel name in TPT
A0 analogIn0
A1 analogIn1
... ...
A15 analogIn15
     
Digital out pins
Digital pin (out) Channel name in TPT
23 digitalOut0
25 digitalOut1
27 digitalOut2
29 digitalOut3
31 digitalOut4
33 digitalOut5
35 digitalOut6
37 digitalOut7
39 digitalOut8
41 digitalOut9
43 digitalOut10
45 digitalOut11
47 digitalOut12
49 digitalOut13
51 digitalOut14
53 digitalOut15
 
Digital in pins
Digital pin (in) Channel name in TPT
22 digitalIn0
24 digitalIn1
26 digitalIn2
28 digitalIn3
30 digitalIn4
32 digitalIn5
34 digitalIn6
36 digitalIn7
38 digitalIn8
40 digitalIn9
42 digitalIn10
44 digitalIn11
46 digitalIn12
48 digitalIn13
50 digitalIn14
52 digitalIn15
Apply a Rename mapping flavor if you want to use other names in the TPT test cases, see Mapping Flavor - Rename.

The following image shows how the pins are mapped in the Declaration Editor to the real pins at the Arduino board when the standard example is used (Arduino Node Example, Arduino from Scratch example).

Arduino Mega2560 pinout used in TPT (by using the provided Mega2560.ino)

In the provided Mega2560.ino it is specified that TPT uses a protocol that enables 16 digital in pins and 16 analog in pins. The analog in pins (A0 to A15) can handle values up to 3FF (= 1.023). The analog out pins can handle values up to FF (= 255) as a PWM value.

To disable some pins or to change the value a pin can handle, write your own protocol and use the Custom Node DLL instead of the Arduino Node, see FUSION Nodes - Custom Node DLL. Use also the Custom Node DLL if you change the default pin mode in your Arduino sketch.

Configuration settings of the Arduino Node

COM Port

By default is COM Port is set to COMxx. Replace the xx by the communication port the Arduino board uses.

You can find the COM port of the Arduino board either in the Windows Device Manger ("Device Manager|Ports (COM & LTP)") or in the Arduino IDE ("Tools|Ports").

Baudrate

The baudrate refers to the rate of data transmission measured in baud. The baudrate is specified in the Arduino sketch. By default, 2.000.000 is set as baudrate in the TPT Arduino Node. If needed, change it to the baudrate specified in your Arduino sketch.

Mapping

Select a mapping from the drop-down list. The mapping must contain a Rename mapping flavor, see Mapping Flavor - Rename, or Scaling mapping flavor, see Mapping Flavor - Scaling, o rboth.